#!/usr/bin/perl
# diskswap.cgi in diskman

require './diskman-lib.pl';

&ReadParse();
$diskindex = $in{'disk'};
@disks = new_get_diskinfo(); 
if ($diskindex =~ /(\d*)/) {
    $dnum = $1;
}
$stat = $disks[$dnum]->{'status'};

if( $stat =~ /Ready/ ) {

    system("arcconf setstate 1 device 0 $diskindex ddd");
}
elsif( $stat =~ /Hot/){
    system("arcconf setstate 1 device 0 $diskindex ddd");

}

&redirect("index.cgi");
#-----------------------------------------------------------------
return;
ERROR_OUT:
&error_setup($text{'del_err_title'});
&error($err);
